//
//  LSHomelessFoundationInfoCollectViewController.m
//  LaSaCivilAffairsDepartment
//
//  Created by 聂志康 on 2019/1/9.
//  Copyright © 2019 wpkj. All rights reserved.
//

#import "LSHomelessFoundationInfoCollectViewController.h"
#import "LSInfoCollectTableViewCell.h"

@interface LSHomelessFoundationInfoCollectViewController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *contentArray;
@end

static NSString *HomelessFoundationInfoCollectCellID = @"HomelessFoundationInfoCollectCellID";

@implementation LSHomelessFoundationInfoCollectViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"流浪乞讨基础信息采集";
    self.view.backgroundColor = UIColor.whiteColor;
    [self.view addSubview:self.tableView];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.contentArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    LSInfoCollectTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:HomelessFoundationInfoCollectCellID forIndexPath:indexPath];
    cell.leftLabel.text = self.contentArray[indexPath.row];
    [cell.leftLabel sizeToFit];
    return cell;
}

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:true];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 44;
}

- (UITableView *)tableView {
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight-SafeAreaTopHeight)];
        _tableView.separatorInset = UIEdgeInsetsZero;
        _tableView.backgroundColor = UIColor.whiteColor;
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.tableFooterView = [UIView new];
        _tableView.backgroundColor = hexColor(EEEEEE);
        UIView *tableViewFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 100)];
        UIButton *submitButton = [[UIButton alloc] initWithFrame:CGRectMake(15, 30, ScreenWidth-30, 40)];
        [submitButton setTitle:@"提交" forState:UIControlStateNormal];
        [submitButton setTitleColor:hexColor(ffffff) forState:UIControlStateNormal];
        submitButton.titleLabel.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:14];
        submitButton.backgroundColor = hexColor(FDBB2C);
        submitButton.layer.cornerRadius = 4;
        submitButton.layer.masksToBounds = true;
        [tableViewFooterView addSubview:submitButton];
        _tableView.tableFooterView = tableViewFooterView;
        [_tableView registerClass:LSInfoCollectTableViewCell.class forCellReuseIdentifier:HomelessFoundationInfoCollectCellID];
    }
    return _tableView;
}

- (NSArray *)contentArray {
    if (!_contentArray) {
        _contentArray = @[
                          @"姓名：",
                          @"性别：",
                          @"民族：",
                          @"身份证号码：",
                          @"出生年月：",
                          @"籍贯：",
                          @"家庭住址：",
                          @"联系方式："
                          ];
    }
    return _contentArray;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
